package cm.tl.pms.common.config;


import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ErnieBotModelProperty {
    private static Properties properties = loadProperties();

    private static Properties loadProperties() {
        Properties props = new Properties();
        try (InputStream input = ErnieBotModelProperty.class.getClassLoader().getResourceAsStream("modelConfig.properties")) {
            if (input == null) {
                System.out.println("Sorry, unable to find modelConfig.properties");
                return props;
            }
            props.load(input);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        return props;
    }

    public static String getChatUrl() {
        return properties.getProperty("ai.model.bot.chatUrl");
    }

    public static String getChatUrlV1() {
        return properties.getProperty("ai.model.bot.chatUrlV1");
    }

    public static String getTokenUrl() {
        return properties.getProperty("ai.model.bot.tokenUrl");
    }

    public static String getClientId() {
        return properties.getProperty("ai.model.bot.clientId");
    }

    public static String getClientSecret() {
        return properties.getProperty("ai.model.bot.clientSecret");
    }

    public static String getAccessToken() {
        return properties.getProperty("ai.model.bot.accessToken");
    }

    public static void main(String[] args) {
        System.out.println(getChatUrl());
    }

    public static String getApiKey() {
        return properties.getProperty("ai.model.bot.apiKey");
    }

    public static String getSecretKey() {
        return properties.getProperty("ai.model.bot.secretKey");
    }
}
